import http from '@/http'
import type { Article } from '@/entity/types.ts'

export const articleService = {
  getArticles: (userId?: number) => http.get<Article[]>('/articles', { params: { userId } }),

  getArticleById: (id: number) => http.get<Article>(`/articles/${id}`),

  createArticle: (data: Partial<Article>) => http.post('/articles', data),

  updateArticle: (id: number, data: Partial<Article>) => http.put(`/articles/${id}`, data),

  deleteArticle: (id: number) => http.delete(`/articles/${id}`),
}
